<%@page import="com.test.objects.Author"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<table cellpadding="3" cellspacing="1" border="0" width="100%" height=500px>
	<tr class="row-title"><td class="header21" align=left>
	</td></tr>
	<tr><td class="intd" align="center" valign="top">
	
<c:set var="isPageSubmitted" value="${isPageSubmitted}" scope="request"/>	
<% 
boolean isPageSubmitted = (Boolean)request.getAttribute("isPageSubmitted");
String username = "", password = "";
if (!isPageSubmitted){
	if (session.getAttribute("author") != null){
		Author author = (Author)session.getAttribute("author");
		username = author.getAccount();
		password = author.getPassword();
	}
%>	
<script language="javascript">
	function setFocus(){
		document.login_form.username.focus();
	}
</script>

	<form action="login.m?page=login" method="post" name="login_form">
		<table cellpadding="0" cellspacing="1" border="0" bgcolor="#4682B4"  width="350"><tr><td>
			<table cellpadding="2" cellspacing="0" border="0" width="350" bgcolor="#DBEAF5">
				<tr><td colspan="2">&nbsp;</td></tr>
				<tr>
					<td nowrap align="right" width="35%">username:</td>
					<td width="65%"><input class="textbox" type="text" name="username" id="username" style="width:180px;" value="<%= username %>"></td>
				</tr>	
				<tr>
					<td nowrap align="right" width="35%">password:</td>
					<td width="65%"><input class="textbox" type="password" name="password" id="password" style="width:180px;" value="<%= password %>"></td>
				</tr>
				<tr><td colspan="2" align="right">
					<input class="button" type="reset" name="clear" value="clear">&nbsp;
					<input class="button" type="submit" name="submit" value="submit">&nbsp;&nbsp;
				</td></tr>
				<tr><td colspan="2" height="5"></td></tr>
			</table></td></tr>
		</table>
	</form>			
	
<% }else{ %>

	<table cellpadding="0" cellspacing="1" border="0" bgcolor="#4682B4"  width="350"><tr><td>
	<table cellpadding="2" cellspacing="0" border="0" width="350" bgcolor="#DBEAF5">
		<tr><td colspan="2">&nbsp;</td></tr>
		<tr><td align="center">
			<font class="button"><c:out escapeXml="false" value="${message}"/></font>
		</td></tr>
		<tr><td colspan="2">&nbsp;</td></tr>
		</table>
	</table><br>

<% } %>
	
	</td></tr>
</table>